package com.czx;

import com.czx.handle.IndexHandle;
import com.czx.service.IndexService;
import com.czx.service.impl.IndexServiceImpl;
import com.czx.util.CustomProxy;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

/**
 * @author topaa
 * @date 2020/9/23 12:28
 */
public class Test {
    public static void main(String[] args) throws IOException, IllegalAccessException, InstantiationException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {
//        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
//        IndexService indexService = (IndexService) Proxy.newProxyInstance(IndexService.class.getClassLoader(),new Class[]{IndexService.class}, new IndexHandle(new IndexServiceImpl()));
        IndexService indexService = (IndexService) CustomProxy.newProxyInstance(IndexService.class, new IndexHandle(new IndexServiceImpl()));
        indexService.show();
        indexService.show("s", 1);
        System.out.println(indexService.m());
        System.out.println(indexService.m(1, 5));
    }
}
